/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package boundaries;

import entities.User;
import controllers.UserManager;
import javax.ejb.EJB;
import javax.inject.Named;
import javax.enterprise.context.RequestScoped;
import javax.faces.application.FacesMessage;
import javax.faces.component.UIComponent;
import javax.faces.component.UIInput;
import javax.faces.context.FacesContext;

/**
 *
 * @author Alberto, Alessandra
 */
@Named(value = "modifyProfileBean")
@RequestScoped
public class ModifyProfileBean {

    @EJB
    private UserManager um;

    private User user;

    public ModifyProfileBean() {
    }

    public User getUser() {
        if (user == null) {
            user = um.getLoggedUser();
        }
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    
    public String save () {
        um.modify(user);
        return "home?faces-redirect=true";
    }

}
